package aiku.numericalcontroloa.Controller.MasterControl;

import aiku.numericalcontroloa.Base.Utils.Result;
import aiku.numericalcontroloa.Model.Dto.MasterControl.MasterDto;
import aiku.numericalcontroloa.Model.Entity.MasterControl.MessageNotification;
import aiku.numericalcontroloa.Service.MasterControl.MasterControlService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 主控台控制层
 * @Author HuangGuangTing
 * @Date 2024/7/8 11:01
 */
@RestController
@RequestMapping("/masterControl")
@Slf4j
public class MasterControl {
    @Autowired
    private MasterControlService masterControlService;

    /**
     * 销售额
     * 可根据年月日查询
     * @param masterDto
     * @return
     */
    @PostMapping("/salesAmount")
    public Result salesAmount(@RequestBody MasterDto masterDto){
        return masterControlService.salesAmount(masterDto);
    }

    /**
     * 回款额
     * 可根据年月日查询
     * @param masterDto
     * @return
     */
    @PostMapping("/refundAmount")
    public Result refundAmount(@RequestBody MasterDto masterDto) {
        return masterControlService.refundAmount(masterDto);
    }

    /**
     * 订单量
     * 可根据年月日查询
     * @param masterDto
     * @return
     */
    @PostMapping("/orderTotal")
    public Result orderTotal(@RequestBody MasterDto masterDto) {
        return masterControlService.orderTotal(masterDto);
    }

    /**
     * 客户量
     * 可根据年月日查询
     * @param masterDto
     * @return
     */
    @PostMapping("/clientTotal")
    public Result clientTotal(@RequestBody MasterDto masterDto) {
        return masterControlService.clientTotal(masterDto);
    }

    /**
     * 新增客户，回访客户排行
     * @return
     */
    @PostMapping("/clientRanking")
    public Result clientRanking(){
        return masterControlService.clientRanking();
    }

    /**
     * 考勤排行
     * @return
     */
    @PostMapping("/attendanceRanking")
    public Result attendanceRanking() {
        return masterControlService.attendanceRanking();
    }

    /**
     * 获取消息通知列表
     * @return
     */
    @PostMapping("/getMsgNotificationList")
    public Result getMsgNotificationList(@RequestBody MasterDto masterDto){
        return masterControlService.getMsgNotificationList(masterDto);
    }

    /**
     * 修改消息通知的状态
     * @param masterDto
     * @return
     */
    @PostMapping("/updateMsgNotification")
    public Result updateMsgNotification(@RequestBody MasterDto masterDto){
        return masterControlService.updateMsgNotification(masterDto);
    }

    /**
     * 删除消息通知
     * @param masterDto
     * @return
     */
    @PostMapping("/deleteMsgNotification")
    public Result deleteMsgNotification(@RequestBody MasterDto masterDto){
        return masterControlService.deleteMsgNotification(masterDto);
    }

    /**
     * 删除个人所有消息
     * @param masterDto
     * @return
     */
    @PostMapping("/deleteMsgAll")
    public Result deleteMsgAll(@RequestBody MasterDto masterDto){
        return masterControlService.deleteMsgAll(masterDto);
    }

    /**
     * 获取月份销售额
     * @return
     */
    @PostMapping("/getSaleroomMonth")
    public Result getSaleroomMonth(String year){
        return masterControlService.getSaleroomMonth(year);
    }

    /**
     * 获取个人的工作时长
     * @return
     */
    @PostMapping("/getWorkingHoursMonth")
    public Result getWorkingHoursMonth(){
        return masterControlService.getWorkingHoursMonth();
    }
}
